package org.xp.judgeplatform.converter;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.xp.judgeplatform.pojo.entity.Problem;
import org.xp.judgeplatform.pojo.vo.ProblemVO.ProblemVO;

import java.util.List;

@Mapper(componentModel = "spring")
public interface ProblemConverter {

    // 忽略时间字段和需要计算的字段
    @Mapping(target = "acceptanceRate", ignore = true)
    @Mapping(target = "authorName", ignore = true)
    ProblemVO toProblemVO(Problem problem);

    // 列表转换
    List<ProblemVO> toProblemVOList(List<Problem> problemList);
}
